<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="copyright" content="http://www.appcms.org" />
<link rel="stylesheet" href="skin/base.css">
<link rel="stylesheet" href="skin/news.css">
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/config.js"></script>
</head>
<body>
<div id="main" class="notnews">
  <ul id="newslist">
  </ul>
</div>
</body>
<script>
	zy_init();
	var id=0;
	function getMain(t){
		if(t==-1){
			id=0;
			$$('newslist').innerHTML='';
			$$('main').className='loading';
		}
		var url = app_path+'index.php?m=iapp&c=app&a=search&tb=news&keyword='+encodeURIComponent(localStorage['keyword']);
		uexXmlHttpMgr.open(t,'post',url,"8000");
		uexXmlHttpMgr.send(t);
	}
	window.uexOnload=function(type){
		if(!type){
			uexWindow.setBounce("1");
			uexWindow.onBounceStateChange=function(t,s){
				if(t=="1"){//下方弹动时
	　　　　　　　　	if(s=="2"){//松开手指时
						getMain(t);
					}
				}
	　　　　	}
			uexXmlHttpMgr.onData = function(opId, status, data){
				if(status==1){
					uexXmlHttpMgr.close(opId);
					uexWindow.resetBounceView(opId);
					data=JSON.parse(data);
					var List=data['list'];
					$$('newslist').className = 'news';
					if(List.length>0){
						$$('main').className='';
											
						for(k in List){
							var li=document.createElement("li");
							li.setAttribute("onclick", "javascript:jump("+List[k]['id']+","+List[k]['catid']+");");
							li.setAttribute("ontouchstart", "javascript:zy_touch('down');");

							var html ='';
							html +='<h3>'+List[k]['title']+'</h3>';
							html +='<div class="loadimg"><img src="'+List[k]['thumb']+'" class="hide" onload="this.className=\'\'" /></div>';
							li.innerHTML = html;
							$$('newslist').appendChild(li);
						}
						
						uexWindow.setBounceParams("1",'{"imagePath":"res://loading.png","textColor":"#666","levelText":"","pullToReloadText":"加载更多","releaseToReloadText":"释放加载","loadingText":"加载中，请稍等"}');
						uexWindow.showBounceView("1","rgba(102,102,102,80)","1");
						uexWindow.notifyBounceEvent("1","1");
					}else{
						uexWindow.hiddenBounceView(1);
						if(opId==-1){
							$$("main").className='notnews';
							id=0;
						}				
					}
					
				}else if(status==-1){
					uexXmlHttpMgr.close(opId);
					if(opId==-1){$$('main').className='errer';}
				}
			}
			if(localStorage['keyword']!=''){
				getMain(-1);
			}
		}
	}
	
	function jump(id,catid){
		localStorage['news_id']=id;
		localStorage['news_catid']=catid;
		uexWindow.open('news_item','0','news_item.html','2','', '',0);
	}
	</script>
</html>